
*Creation of intermediate files	
shp2dta using "$dataDir/geo/dest_2010gw/dest_2010gw.shp", database("$tempDir/dest_2010gw_db") coord("$tempDir/dest_2010gw_coord") replace

shp2dta using "$dataDir/geo/muni_2018gw/muni_2018gw.shp", database("$tempDir/muni_2018gw_db") coord("$tempDir/muni_2018gw_coord") replace

*Figure 1 a)
use "$tempDir/dest_2010gw_db", replace
		spmap using "$tempDir/dest_2010gw_coord",  fcolor(white) clnumber(2) id(_ID)  ///
		point(data("$dataDir/dataset_treatment_fires2012") by(treatment) x(longitud) y(latitud) fcolor(gs8 orange sky) ocolor(none none none) size(tiny small small) shape(square circle triangle) legenda(on)) ///
		ocolor(gs10 ..) osize(vthin ..) ///
		 legend(position(8) label(3 "Fires (2012)") label(4 "Unregulated") label(5 "Regulated") rowgap(1) cols(3) region(lcolor(black)))
			gr_edit legend.plotregion1.label[1].style.editstyle size(medsmall) 
			gr_edit legend.plotregion1.label[2].style.editstyle size(medsmall) 
			gr_edit legend.plotregion1.label[3].style.editstyle size(medsmall)			
			graph export "$mainDir/figures/Fig1a_map_treatment.pdf", replace as(pdf)
			
*Figure 1 b)

use "$dataDir/dataset_fires_mun_year", clear			

collapse (sum) shf, by(idmun year)

gen post_policy=(year>=2015)

collapse (mean) shf, by(post_policy idmun)

reshape wide shf, i(idmun) j(post_policy)

gen shf_pct_change=(shf1-shf0)/shf0

save "$tempDir/dataset_change_shf", replace

use "$tempDir/muni_2018gw_db", replace
	gen idmun=CVEGEO
	merge 1:1 idmun using "$tempDir/dataset_change_shf"
	gen rshf_pct_change=round(shf_pct_change,.001)
	
		spmap rshf_pct_change using "$tempDir/muni_2018gw_coord", id(_ID) ocolor(gs10 ..) osize(vvthin ..)  clnumber(7) fcolor(BuRd) ndfcolor(white ..) ndocolor(gs12 ..) ndsize(vthin ..) legend(region(lcolor(black)) pos(2) title("%{&Delta} fires", size(small)))
			graph export "$mainDir/figures/Fig1b_change_fires_municipalities.pdf", replace as(pdf)
		

